<?php
session_start();
require "page/login.php";
?>
<link rel="stylesheet" href="css/header.css">
<div class="row h">
    <?php
    if (!$_SESSION['login_user']){
        ?>
        <a href="#" data-toggle="modal" data-target="#exampleModal">请登录</a>
        <a href="page/registered.php">免费注册</a>
        <?php
    }else{
        $userName = unserialize($_SESSION['login_user'])['userName'];
        echo "<a href='#'>你好  $userName  欢迎使用！</a>     <a href='action/die_session.php' >【安全退出】</a>";
    }
    ?>

    <ul>
        <li><a href="page/item.php">我的订单</a></li>
        <li>|</li>
        <li>Tel：000-0000-000</li>
    </ul>
</div>

<div class="row s">
    <!--logo-->
    <div class="col-md-2">
        <img src="img/logo.png" alt="logo" class="img-responsive" width="220">
    </div>

    <!--搜索框-->
    <div class="col-md-8">
        <input class="search_input" type="text" placeholder="" id="key">
        <a class="search_input" href="#"  onclick="search_a()"><span class="glyphicon glyphicon-search color" aria-hidden="true"></span></a>
    </div><!-- /.col-lg-6 -->

    <!--购物车-->
    <div class="col-md-2">
        <a href="page/cart.php" title="购物车">
            <span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span>
            <span>购物车</span>
            <span class="badge color">0</span>
        </a>

    </div>
</div>

<script>
    function search_a() {
        // alert("1111111");
        var key = document.getElementById("key").value;
        if (key==""){
            alert("输入要搜索的关键字");
            return;
        } else{
            window.open("page/book_list.php?key="+key);
        }
    }
</script>

